home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
SNDLIST-
/
SNDINIT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-11-10
|
1KB
|
45 lines
/*
This INIT will show it's ICN# and then plays all
'snd ' resources from its own resource fork.
Set the project to "code resource" of type 'INIT'.
Use ResEdit to put the CODE resource into the "Sound" cdev
file in the system folder. Clear the "no init" bit.
Copy the 'snd ' resources you want into the "Sound" cdev.
Note: this works only for System 6.0 or later, if you have
a Mac Plus.
*/
#include <ResourceMgr.h>
#include <SoundMgr.h>
#define ICON -4064 /* Resource id of 'ICN#' */
#define HLock(h) asm { \
MOVE.L h,A0 \
_HLock \
}
main()
{
register Handle h;
register int i, n;
/* Note: all registers are saved/restored by the system */
asm {
MOVE.L A0,A4 /* A4 used for global and static data */
_RecoverHandle
_HLock /* Make sure our CODE is locked */
}
ShowINIT(ICON); /* INIT notification */
n = Count1Resources(soundListRsrc);
for (i = 1; i <= n; i++)
if (h = Get1IndResource(soundListRsrc, i)) {
HLock(h);
SndPlay(0L, h, FALSE);
ReleaseResource(h);
}
}